/**
 * Created by oureda on 4/23/16.
 */
var express = require("express");
var router = express.Router();
var config = require("../config");
var path = require("path");
var fs = require("fs");
var db = require("../models/index");
var auth = require("../instances/auth");
var msgWrapper = require("../helpers/msgWrapper");
var Data = db.models.Data;
var Session = require('../instances/session');

router.use(function(req,res,next){
    next();
});


var loadDir = (dir) => {
    fs
        .readdirSync(dir)
        .forEach( (file) => {
            var nextPath = path.join(dir, file);
            var stat = fs.statSync(nextPath);
            if (stat.isDirectory()) {
                loadDir(nextPath);
            } else if (stat.isFile() && file.indexOf('.') !== 0 && file !== 'index.js') {
                require(nextPath)(router);
            }
        });
};

loadDir(__dirname);

module.exports = router;